/*  1:   */ package org.jetbrains.jps.model.artifact.impl.elements;
/*  2:   */ 
/*  3:   */

import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.artifact.elements.JpsLibraryFilesPackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElementFactory;
import org.jetbrains.jps.model.artifact.elements.ex.JpsComplexPackagingElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryReference;
import org.jetbrains.jps.model.library.JpsOrderRootType;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */
/* 16:   */
/* 17:   */
/* 18:   */
/* 19:   */ 
/* 20:   */ public class JpsLibraryFilesPackagingElementImpl
/* 21:   */   extends JpsComplexPackagingElementBase<JpsLibraryFilesPackagingElementImpl>
/* 22:   */   implements JpsLibraryFilesPackagingElement
/* 23:   */ {
/* 24:40 */   private static final JpsElementChildRole<JpsLibraryReference> a = JpsElementChildRoleBase.create("library reference");
/* 25:   */   
/* 26:   */   public JpsLibraryFilesPackagingElementImpl(@NotNull JpsLibraryReference paramJpsLibraryReference)
/* 27:   */   {
/* 28:43 */     this.myContainer.setChild(a, paramJpsLibraryReference);
/* 29:   */   }
/* 30:   */   
/* 31:   */   private JpsLibraryFilesPackagingElementImpl(JpsLibraryFilesPackagingElementImpl paramJpsLibraryFilesPackagingElementImpl)
/* 32:   */   {
/* 33:47 */     super(paramJpsLibraryFilesPackagingElementImpl);
/* 34:   */   }
/* 35:   */   
/* 36:   */   @NotNull
/* 37:   */   public JpsLibraryFilesPackagingElementImpl createCopy()
/* 38:   */   {
/* 39:53 */     void tmp8_5 = new JpsLibraryFilesPackagingElementImpl(this);
/* 40:53 */     if (tmp8_5 == null) {
/* 41:53 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/artifact/impl/elements/JpsLibraryFilesPackagingElementImpl", "createCopy" }));
/* 42:   */     }
/* 43:53 */     return tmp8_5;
/* 44:   */   }
/* 45:   */   
/* 46:   */   @NotNull
/* 47:   */   public JpsLibraryReference getLibraryReference()
/* 48:   */   {
/* 49:59 */     JpsLibraryReference tmp13_10 = ((JpsLibraryReference)this.myContainer.getChild(a));
/* 50:59 */     if (tmp13_10 == null) {
/* 51:59 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/artifact/impl/elements/JpsLibraryFilesPackagingElementImpl", "getLibraryReference" }));
/* 52:   */     }
/* 53:59 */     return tmp13_10;
/* 54:   */   }
/* 55:   */   
/* 56:   */   public List<JpsPackagingElement> getSubstitution()
/* 57:   */   {
/* 58:64 */     JpsLibrary localJpsLibrary = (JpsLibrary)getLibraryReference().resolve();
/* 59:65 */     if (localJpsLibrary == null) {
/* 60:65 */       return Collections.emptyList();
/* 61:   */     }
/* 62:66 */     ArrayList localArrayList = new ArrayList();
/* 63:67 */     for (File localFile : localJpsLibrary.getFiles(JpsOrderRootType.COMPILED))
/* 64:   */     {
/* 65:68 */       String str = FileUtil.toSystemIndependentName(localFile.getAbsolutePath());
/* 66:69 */       if (localFile.isDirectory()) {
/* 67:70 */         localArrayList.add(JpsPackagingElementFactory.getInstance().createDirectoryCopy(str));
/* 68:   */       } else {
/* 69:73 */         localArrayList.add(JpsPackagingElementFactory.getInstance().createFileCopy(str, null));
/* 70:   */       }
/* 71:   */     }
/* 72:76 */     return localArrayList;
/* 73:   */   }
/* 74:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.artifact.impl.elements.JpsLibraryFilesPackagingElementImpl

 * JD-Core Version:    0.7.0.1

 */